﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AncientEmpires_025_132
{
    public class SkirmishSetup
    {
        public enum TypeUpdate
        {
            UpdateMoney,
            UpdateUnitCap
        }
        public enum Navigate
        {
            Next,
            Back
        }

        private int _money;

        public int Money
        {
            get { return _money; }
            set { _money = value; }
        }

        private int _unitCap;

        public int UnitCap
        {
            get { return _unitCap; }
            set { _unitCap = value; }
        }

        private List<NationSetup> _listNationSetup;

        public List<NationSetup> ListNationSetup
        {
            get { return _listNationSetup; }
            set { _listNationSetup = value; }
        }

        public SkirmishSetup(int numNation)
        {
            _money = 500;
            _unitCap = 10;
            ListNationSetup = new List<NationSetup>();
            for (int i = 0; i < numNation; i++)
            {
                NationSetup tempNationSetup = new NationSetup();
                tempNationSetup.TypeNationSetup = TypeNation.Player;
                switch(i)
                {
                    case 0:
                        tempNationSetup.TeamNameSetup = TeamName.Team1;
                        tempNationSetup.NationNameNationSetup = NationName.Red;
                        break;
                    case 1:
                        tempNationSetup.TeamNameSetup = TeamName.Team2;
                        tempNationSetup.NationNameNationSetup = NationName.Green;
                        break;
                    case 2:
                        tempNationSetup.TeamNameSetup = TeamName.Team3;
                        tempNationSetup.NationNameNationSetup = NationName.Blue;
                        break;
                    case 3:
                        tempNationSetup.TeamNameSetup = TeamName.Team4;
                        tempNationSetup.NationNameNationSetup = NationName.Black;
                        break;
                }
                ListNationSetup.Add(tempNationSetup);
            }
        }

        public void Update(TypeUpdate typeUpdate, Navigate nav)
        {
            switch (typeUpdate)
            { 
                case TypeUpdate.UpdateMoney:
                    switch (_money)
                    { 
                        case 500:
                            if (nav == Navigate.Back) Money = 2000;
                            else Money = 1000;
                            break;
                        case 1000:
                            if (nav == Navigate.Back) Money = 500;
                            else Money = 2000;
                            break;
                        case 2000:
                            if (nav == Navigate.Back) Money = 1000;
                            else Money = 500;
                            break;
                    }
                    break;
                case TypeUpdate.UpdateUnitCap:
                    switch (_unitCap)
                    {
                        case 10:
                            if (nav == Navigate.Back) UnitCap = 25;
                            else UnitCap = 20;
                            break;
                        case 20:
                            if (nav == Navigate.Back) UnitCap = 10;
                            else UnitCap = 25;
                            break;
                        case 25:
                            if (nav == Navigate.Back) UnitCap = 20;
                            else UnitCap = 10;
                            break;
                    }
                    break;
            }
        }
    }
}
